if WITH_CUDA
MCRXCUDA_LIBS = $(CUTIL_LIB) -lcudart
MCRXCUDA_CHECKPROGRAMS = cuda_grain_temp_test
endif

if WITH_AREPO
AREPO_CHECKPROGRAMS = arepotest
CXXFLAGS_AREPO =$(MPI_CXXFLAGS)
LDFLAGS_AREPO =$(MPI_LDFLAGS)
AREPO_LIBS = -larepo -lgsl -lgmp $(MPI_LIBS)
endif

AM_CXXFLAGS = ${PTHREAD_CFLAGS} -I../src $(CXXFLAGS_AREPO)
AM_LDFLAGS = -L../src $(LDFLAGS_AREPO)
check_PROGRAMS = montecarlo_test ir_thick_test pascucci_test mlt_pascucci scattered_intensity watson_henney megagrains_test grain_temp_test cloud blackbody_test greenhouse baes_validation mappings_test wg96 $(MCRXCUDA_CHECKPROGRAMS) $(AREPO_CHECKPROGRAMS)

mappings_test_SOURCES = mappings_test.cc
mappings_test_LDADD = -lmcrx  $(BOOST_THREAD_LIB)
mappings_test_DEPENDENCIES = ../src/libmcrx.a

montecarlo_test_SOURCES = montecarlo_test.cc
montecarlo_test_LDADD = -lmcrx $(BOOST_THREAD_LIB)
montecarlo_test_DEPENDENCIES = ../src/libmcrx.a

ir_thick_test_SOURCES = ir_thick_test.cc ../src/grain_model_factory.cc
ir_thick_test_LDADD = -lmcrx $(BOOST_THREAD_LIB) $(BOOST_PROGRAM_OPTIONS_LIB)  $(MCRXCUDA_LIBS)
ir_thick_test_DEPENDENCIES = ../src/libmcrx.a

megagrains_test_SOURCES = megagrains_test.cc
megagrains_test_LDADD = -lmcrx $(BOOST_THREAD_LIB)
megagrains_test_DEPENDENCIES = ../src/libmcrx.a

grain_temp_test_SOURCES = grain_temp_test.cc
grain_temp_test_LDADD = -lmcrx $(BOOST_THREAD_LIB)  $(MCRXCUDA_LIBS)
grain_temp_test_LDFLAGS = $(BOOST_LDFLAGS)
grain_temp_test_DEPENDENCIES = ../src/libmcrx.a

pascucci_test_SOURCES = pascucci.cc ../src/grain_model_factory.cc
pascucci_test_LDADD = -lmcrx $(BOOST_THREAD_LIB) $(BOOST_PROGRAM_OPTIONS_LIB)  $(MCRXCUDA_LIBS)
pascucci_test_DEPENDENCIES = ../src/libmcrx.a

mlt_pascucci_SOURCES = mlt_pascucci.cc
mlt_pascucci_LDADD = -lmcrx $(BOOST_THREAD_LIB) $(BOOST_PROGRAM_OPTIONS_LIB)  $(MCRXCUDA_LIBS)
mlt_pascucci_DEPENDENCIES = ../src/libmcrx.a

wg96_SOURCES = wg96.cc ../src/grain_model_factory.cc
wg96_LDADD = -lmcrx $(BOOST_THREAD_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(MCRXCUDA_LIBS)
wg96_DEPENDENCIES = ../src/libmcrx.a

cloud_SOURCES = cloud.cc ../src/grain_model_factory.cc
cloud_LDADD = -lmcrx $(BOOST_THREAD_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(MCRXCUDA_LIBS)
cloud_DEPENDENCIES = ../src/libmcrx.a

greenhouse_SOURCES = greenhouse.cc
greenhouse_LDADD = -lmcrx $(BOOST_THREAD_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(MCRXCUDA_LIBS)
greenhouse_DEPENDENCIES = ../src/libmcrx.a

cuda_grain_temp_test_SOURCES = cuda_grain_temp_test.cc
cuda_grain_temp_test_LDADD = -lmcrx $(BOOST_THREAD_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(MCRXCUDA_LIBS)
cuda_grain_temp_test_LDFLAGS = $(BOOST_LDFLAGS)
cuda_grain_temp_test_DEPENDENCIES = ../src/libmcrx.a

#ivezic_SOURCES = ivezic.cc
#ivezic_LDADD = -lmcrx $(BOOST_THREAD_LIB)
#ivezic_DEPENDENCIES = ../src/libmcrx.a

baes_validation_SOURCES = baes_validation.cc
baes_validation_LDADD = -lmcrx $(BOOST_THREAD_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(MCRXCUDA_LIBS)
baes_validation_DEPENDENCIES = ../src/libmcrx.a

scattered_intensity_SOURCES = scattered_intensity.cc
scattered_intensity_LDADD = -lmcrx $(BOOST_THREAD_LIB)
scattered_intensity_DEPENDENCIES = ../src/libmcrx.a

watson_henney_SOURCES = watson_henney.cc
watson_henney_LDADD = -lmcrx $(BOOST_THREAD_LIB)
watson_henney_DEPENDENCIES = ../src/libmcrx.a

blackbody_test_SOURCES = blackbody_test.cc
blackbody_test_LDADD = -lmcrx $(BOOST_THREAD_LIB) $(MCRXCUDA_LIBS)
blackbody_test_DEPENDENCIES = ../src/libmcrx.a

arepotest_SOURCES = arepotest.cc
arepotest_LDADD = -lmcrx $(BOOST_THREAD_LIB) $(BOOST_PROGRAM_OPTIONS_LIB) $(MCRXCUDA_LIBS) $(X11_LIBS) $(AREPO_LIBS)
arepotest_LDFLAGS = -L.
arepotest_DEPENDENCIES = ../src/libmcrx.a
